package com.softeem.score.manager.controller.admin;


import com.github.pagehelper.PageInfo;
import com.softeem.score.common.log.annotation.Log;
import com.softeem.score.common.log.enums.OperatorType;
import com.softeem.score.common.log.service.AsyncOperLogService;
import com.softeem.score.model.dto.SysOperLogDto;
import com.softeem.score.model.entity.system.SysOperLog;
import com.softeem.score.model.entity.system.SysRole;
import com.softeem.score.model.vo.common.Result;
import com.softeem.score.model.vo.common.ResultCodeEnum;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author zhu
 * @since 2024-02-14
 */
@Tag(name = "操作记录")
@RestController
@RequestMapping("/admin/sys/sysOperationLog")
public class SysOperationLogController {

    @Autowired
    private AsyncOperLogService asyncOperLogService;

    @Log(title = "分页查询操作记录", businessType = 0, operatorType = OperatorType.MANAGE)
    @Operation(summary = "分页查询操作记录")
    @GetMapping("/findByPage/{pageNum}/{pageSize}")
    public Result<PageInfo<SysRole>> findByPage(@PathVariable(value = "pageNum") Integer pageNum,
                                                @PathVariable(value = "pageSize") Integer pageSize,
                                                SysOperLogDto sysOperLogDto) {
        PageInfo<SysOperLog> pageInfo = asyncOperLogService.findByPage(sysOperLogDto, pageNum, pageSize);
        return Result.build(pageInfo, ResultCodeEnum.SUCCESS);
    }

}

